package cinema.util;

import java.util.Scanner;

public class InputUtil {
    private static final Scanner sc = new Scanner(System.in);
    public static String readLine(String prompt) {
        System.out.print(prompt);
        return sc.nextLine();
    }
    public static int readInt(String prompt) {
        while (true) {
            try { return Integer.parseInt(readLine(prompt)); } catch (Exception e) { System.out.println("请输入整数"); }
        }
    }
    public static double readDouble(String prompt) {
        while (true) {
            try { return Double.parseDouble(readLine(prompt)); } catch (Exception e) { System.out.println("请输入数字"); }
        }
    }
}